CREATE OR REPLACE VIEW VPI.VIEW_CACHE_SAFE_PERIOD AS
SELECT
	CACHE_ID,
	CACHE_EXPIRY * 60		AS CACHE_SECONDS,
	NVL2(REFRESH_END, CACHE_EXPIRY * 60 - (SYSDATE - REFRESH_END) * 86400, 0)
							AS SAFE_SECONDS,
	NVL2(REFRESH_END, REFRESH_END + CACHE_EXPIRY / 1440, SYSDATE)
							AS READABLE_BEFORE,
	DESCRIPTION_,
	REFRESH_START,
	REFRESH_END
FROM
	VPI.CACHE_CONTROL

WITH READ ONLY;
